/*
 * Copyright (c) 2020, 2023, 3044483124@qq.com All rights reserved.
 *
 */
package cn.itcast;

/**
 * <p>Project: JavaStudy - Var3
 * <p>Powered by jiangbo On 2023-01-30
 * 21:28:11
 * <p>Created by IntelliJ IDEA
 *
 * @author jiangbo [3044483124@qq.com]
 * @version 1.0
 * @since 8/17
 */
public class Var3 {
    public static void main(String[] args) {
        int a = 5;
        a += 1;
        a = a + 1;
        System.out.println(a);//7
        short b = (short) a;//7
        b += 1;//b 8 (+=可以实现自动的类型转换)
        a = b + 1;//a = 9 b=8 (b+1 结果类型为int 此)
        System.out.println(a);//9
        System.out.println(b);//8

        //将int 3 自动转换为short 赋值
        short i = 3;
//short 类型自动转换 int
        int s = i;
//强制转换
        byte n = (byte)s;
//String str = "hello";
//int num = (int)str;
        String str = "100";
        int num = Integer.parseInt(str);
        System.out.println(num + 5);

    }
}


